//
//  YJDistrictModel.m
//  YJB
//
//  Created by 韦朝宾 on 16/5/28.
//  Copyright © 2016年 YJB. All rights reserved.
//

#import "YJDistrictModel.h"

@implementation YJDistrictModel
- (instancetype)initWithDict:(NSDictionary *)dict
{
    if (self = [super init])
    {
        _province = dict[@"DivisionName"];
        _cities = [YJCityModel citiesWithArray:dict[@"DivisionSub"]];
    }
    return self;
}

+ (instancetype)provinceWithDict:(NSDictionary *)dict
{
    return [[self alloc]initWithDict:dict];
}

+ (NSMutableArray *)districtsWithArray:(NSArray *)array
{
    NSMutableArray *provinces = [NSMutableArray array];
    for (NSDictionary *dict in array)
    {
        YJDistrictModel *province = [self provinceWithDict:dict];
        [provinces addObject:province];
    }
    return provinces;
}
@end
